package cn.kgc.controller;

import cn.kgc.dto.ResultInfo;
import cn.kgc.pojo.Contact;
import cn.kgc.service.ContactService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@CrossOrigin
@Api("根据id删除")
@RequestMapping("/del")
public class DelByIdController {
    @Resource
    private ContactService contactService;
    @ApiOperation("根据id删除")
    @ApiImplicitParam(name = "id",value = "id",required = true)
    @GetMapping(value = "/delById")
    public ResultInfo delById(int id){
        try {
            return new ResultInfo(200,"查询成功",contactService.removeContactById(id));
        }catch (Exception e){
            return new ResultInfo(500,"查询失败",null);

        }
    }
}
